<div id="containercenter">
	<?php 
		require('navigation.php');
		require('navHistory.php'); 
		$user_id = $_GET['id'];
		$profile->load($user_id);
		if(!$profile->load($user_id)){
			header("Location: index.php");
		}
		$credit = new Credit();
		
	?>
	<div id="containerleft" <?php if(isset($_GET['mode']) && $_GET['mode'] == 'CreditHistory'){ echo "style='width: 100%;border-right:0px solid #CCCCCC;'";}else{echo "style='width: 75%;border-right:1px solid #CCCCCC;'";}?>>
		<div id="leftSide">
			<div id="profileTitle">
				<h2>Profilo di <?php echo $user->getUser($_GET['id']); if($user->level != 0 ){ echo " <img style='margin-bottom:-2px; cursor: pointer;' src='static/images/icon/checkip.png' onclick='showIp();'/></a><span id='ipaddress' style='display: none; font-size: 9px; color: #FFFFCC;'> IP Address: " . $login->getIPAddress($_GET['id']) . "</span>";}?></h2> 
			</div>
			<div id="profileNavigation">
				<ul id="profileNavlist">
					<li><a href="?p=profile&id=<?php echo $_GET['id']; ?>" <?php if($_GET['p'] == 'home') { echo "class='selected'"; } ?>>Riepilogo</a></li>
					<?php if($_GET['id']==$user->id){ ?>
						<li><a href="?p=profile&id=<?php echo $user->id; ?>&mode=EditProfile" <?php if($_GET['p'] == 'profile') { echo "class='selected'"; } ?>>Modifica</a></li>
					<?php } ?>	
					<li><a href="?p=profile&id=<?php echo $_GET['id']; ?>&mode=CreditHistory" <?php if($_GET['p'] == 'blackjack') { echo "class='selected'"; } ?>>Storico Crediti</a></li>
				</ul>
			</div>
			
			<div id="profileLayout">
				<div class="avatar">
					<img class="avatar" alt="Immagine personale di <?php echo $user->getUsername();?>" src="<?php echo $profile->avatar;?>"/>
				</div>
				<div class="info">
					<ul class="profileInfo">
						<h3>Informazioni utente</h3> 
						<li><b>Stato: </b> <?php echo $profile->getLastPageTime($user_id);?></li>
						<li class="alias"><b>Alias: </b><?php echo $profile->alias;?></li>
						<li><b>Et&agrave;: </b><?php echo $profile->getAge();?></li>
						<li><b>Luogo: </b><?php echo $city->getCity($user_id);?></li>
						<li><b>Crediti: </b><?php echo $credit->getBalance($user_id);?></li>
						<li><b>Totale login: </b><?php echo $login->getNrLogins($user_id);?></li>
					</ul>
				</div>
				<div class="profileDescription">
					<?php echo $profile->description; ?>
				</div>
			</div>
		</div
		<div id="rightSide">	
			<div class="profileDinamicPage">
				<?php 
				if(isset($_GET['mode'])){
					switch($_GET['mode']){
						case 'EditProfile':
							if($_GET['id']==$user->id){
								include('php/pages/editProfile.php');
							}
						break;
						case 'CreditHistory':
							include('php/pages/creditHistory.php');
						break;
						default:
							echo 'Pagina non trovata!';
						break;
						
					}
				}	
				?>
				
			</div>	
		</div
		
		
	</div>
	
	<?php 
		if(isset($_GET['mode']) && ($_GET['mode'] == 'CreditHistory')){
			return;
		}else{
	?>
	<div id="containerright">
		<h2>Statistiche generali</h2>
		<h3><img style="margin-bottom:-4px;" src="static/images/icon/nintendo.png"><i> Gioco</i></h3>
		<ul class="stats">
			<li>Vincita pi&ugrave; alta: <b>1462</b> crediti </li>
			<li>Blackjack totali: <b>132</b></li>
			<li>Partite in corso: <b>5</b></li>
		</ul>
		
		<h3><img style="margin-bottom:-3px;" src="static/images/icon/users.png"></img><i> Utenza</i></h3>
		
		<ul class="stats">
			<li>Utenti totali: <b>864</b></li>
			<li>Utenti online: <b>42</b> </li>
			<li>Utenti in gioco: <b>23</b> </li>
		</ul>
		
		<a href="index.php?p=credits">
			<div class="creditBox">
				<img class="minipic" alt="Acquista crediti" src="static/images/icon/paypal.jpg"/>
				<br/>
				Compra crediti
			</div>
		</a>

	</div>
	
	<?php
		}
	?>
</div>